import React, { useEffect, useState } from 'react'

import { formatDate } from '../../utils/dayjs'

import { CartItem } from '../../types'

import houseApi from '../../services/axios'

export default function Login() {
    const [list, setList] = useState<CartItem[]>([]);
    // 调用houseApi.get方法获取数据
    useEffect(() => {
        getList();
    }, []);

    const getList = async () => {
        const { data:{data} } = await houseApi.get('/list');
        setList(data);
        console.log(data);
    }

    return (
        <div>Login

            {/* // 调用formatDate方法格式化当前日期 */}
            <p>{formatDate(new Date(), 'YYYY-MM-DD')}</p>
        </div>
    )
}
